﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ExtractTheValueOfABit
{
    class Program
    {
        static void Main(string[] args)
        {
            int i = 5;
            int b = 2;
            // Console.WriteLine(Convert.ToString(number,2).PadLeft(8,'0'));

            int mask = 1 << b;
            int value = ((i & mask) >> b);
            Console.WriteLine("The value of the bth bit is: {0}", value);
               
        }
    }
}
